<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>class声明的方法为什么不能遍历</title>
  </head>
  <body></body>
  <script>
    class User {
      constructor(name) {
        this.name = name;
      }
      show() {
        console.log(this.name);
      }
    }
    let u = new User("李四");
    // "enumerable": false,
    console.log(
      JSON.stringify(
        Object.getOwnPropertyDescriptor(User.prototype, "show"),
        null,
        2
      )
    );
    for (const key in u) {
      console.log(key);
    }
  </script>
</html>
